<!--
  ~ /*
  ~  (C) Copyright 2016 Ymatou (http://www.ymatou.com/).
  ~  All rights reserved.
  ~  */
  -->

<div class="widgets">

  <div class="row">
    <div class="col-md-12">
      <div ba-panel ba-panel-title="监控列表" ba-panel-class="with-scroll">
        <div style="padding-bottom:20px;">
          <form novalidate>
              <pre style="padding-top: 10px;white-space: nowrap">
                  监控名称<input name="name" type="text" ng-model="obj.name">
                  &nbsp;&nbsp;数据源
                <select ng-model="obj.dbSource">
                  <option value="">----请选择----</option>
                  <option ng-repeat="s in dbSources" value="{{s}}">{{s}}</option>
                </select>
                  &nbsp;&nbsp;运行状态
                <select ng-model="obj.runStatus">
                  <option value="">----请选择----</option>
                  <option ng-repeat="s in runStatuss" value="{{s.value}}">{{s.text}}</option>
                </select>
                  &nbsp;&nbsp;创建人<input name="createUser" type="text" ng-model="obj.createUser">
                  <button class="btn btn-primary btn-large" ng-click="search()">查询</button>
                  <button class="btn btn-info btn-large" ng-click="create()">创建监控</button>
              </pre>
          </form>
        </div>
        <div class="horizontal-scroll">
          <table class="table">
            <thead>
            <tr>
              <th class="table-id" >#</th>
              <th>监控名称</th>
              <th>数据源</th>
              <th>Script</th>
              <th>Cron表达式</th>
              <th>运行状态</th>
              <th>上次执行时间</th>
              <th>下次执行时间</th>
              <th>创建人</th>
              <th>修改时间</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in list">
              <td class="table-id">{{item.id}}</td>
              <td>{{item.name}}</td>
              <td>{{item.dbSource}}</td>
              <td><a info="true" value="{{item.sql}}" href="javascript:;" >{{item.sql | limit:80}}</a></td>
              <td>{{item.cronExpression}}</a></td>
              <td>{{showRunStatus(item.runStatus) }}</td>
              <td>{{item.lastFireTime}}</td>
              <td>{{item.nextFireTime}}</td>
              <td>{{item.createUser}}</td>
              <td>{{item.updateTime}}</td>
              <td>
                <button class="btn btn-primary btn-xs" ui-sref="monitor.monitor-add({id:item.id})">Edit</button>
                <button class="btn btn-primary btn-xs" ng-show="item.runStatus == 'RUNNING'" ng-click="pause(item.id)">暂停</button>
                <button class="btn btn-primary btn-xs" ng-show="item.runStatus == 'STOPPED'" ng-click="resume(item.id)">启动</button>
                <button class="btn btn-primary btn-xs" ng-click="runNow(item.id)">立即运行</button>
                <button class="btn btn-danger btn-xs" ng-click="delete(item.id)">Delete</button>
              </td>
            </tr>
            </tbody>
          </table>
          <paging
                  page="page"
                  page-size="pageSize"
                  total="total"
                  show-prev-next="true"
                  show-first-last="true"
                  scroll-top="true"
                  paging-action="pagingAction(page, pageSize,total)"
                  ></paging>
        </div>
      </div>
    </div>
  </div>

</div>